<template>
	<om-formsub-outer :index="index">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {subOnLoad, changeEditor,configSelectData} from '../../../static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return {
				initValue:{
				},
				autoformdata: [],
				cachename:'',
				index:null,
				datas:[],
				order:0,
				formdata:{}
			}
		},
		methods: {
			initLoad(){
				let _that = this
				changeEditor(_that.autoformdata[0].editors, "startTime","endField","endTime")
				changeEditor(_that.autoformdata[0].editors, "endTime","startField","startTime")	
				//交通工具
				_that.om.request('dictZero/getCombobox', {
					code: "37373"					
				}).then(res => {
					_that.$refs.autoform.changeEditor("title7", "vehicleCode", "data", configSelectData(res, "code", "dicname"))
					_that.$refs.autoform.initSelectIndex("title7", "vehicleCode")
				});
			}
		},
		onLoad(e){
			let _that = this
			subOnLoad(_that, e, function() {
				if(e.configDataCacheKey){
					uni.getStorage({
						key: e.configDataCacheKey,
						success: function(res) {
							//if(res.data && res.data instanceof Array){
							if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
								_that.autoformdata = res.data
								Object.assign(_that.initValue, _that.formdata)
								_that.autoformdata[0].order = _that.order
								_that.initLoad()
							}
						}
					});
				}
			})
		}
	}
</script>

<style>

</style>
